package com.dcy.flyweight;

/**
 * @Author：dcy
 * @Description:
 * @Date: 2021/1/25 8:49
 */
public class Client {
    public static void main(String[] args) {
        WebSiteFactory factory = new WebSiteFactory();

        // 客户要一个以新闻形式发布得网站
        WebSite webSite1 = factory.getWebSiteCategory("新闻");
        User user = new User();
        user.setName("tom");
        webSite1.use(user);

        // 客户要一个以博客形式发布得网站
        WebSite webSite2 = factory.getWebSiteCategory("博客");
        User user2 = new User();
        user2.setName("jack");
        webSite2.use(user2);

        // 客户要一个以博客形式发布得网站
        WebSite webSite3 = factory.getWebSiteCategory("博客");
        User user3 = new User();
        user3.setName("king");
        webSite3.use(user3);

        System.out.println("网站得分类共：" + factory.getWebSiteCount());
    }
}
